package org.example.casemodule.enums;

public enum CaseStatus {
    //"PENDING","REVIEWING","ASSIGNED","IN_PROGRESS","COMPLETED","CLOSED"
    PENDING("PENDING", "待审核"),
    REVIEWING("REVIEWING", "审核中"),
    ASSIGNED("ASSIGNED", "已分配"),
    IN_PROGRESS("IN_PROGRESS", "进行中"),
    COMPLETED("COMPLETED", "已完成"),
    CLOSED("CLOSED", "已关闭");

    private final String code;
    private final String info;

    CaseStatus(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public String getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public static CaseStatus getByCode(String code) {
        for (CaseStatus caseStatus : CaseStatus.values()) {
            if (caseStatus.getCode().equals(code)) {
                return caseStatus;
            }
        }
        return null;
    }

    public static CaseStatus getByInfo(String info) {
        for (CaseStatus caseStatus : CaseStatus.values()) {
            if (caseStatus.getInfo().equals(info)) {
                return caseStatus;
            }
        }
        return null;
    }
}
